{% extends "base.html" %}

{% block title %}{{device.name}}{% endblock %}

{% block head %}
<link href="/medias/css/app.css" rel="stylesheet" type="text/css"/>
<script src="/medias/js/jquery.raty.min.js"></script>
<script type="text/javascript">
$(function() {

   $('#star').raty({
		showHalf: true,
		start:"{{score_val}}",
		hintList:     ['太差', '差', '一般', '好', '非常好'],
		readOnly:("{{app.isStar}}"!="0"),
		onClick: function(score) {
			
			$.ajax({
			   type: "POST",
			   url: "/app/star/",
			   data:{"appid":"{{app.id}}","star":score},
			   success: function(result){
			   	
			   	  if(result=="need login")
				  {
				  	alert("您还没有登录，请登录后评分");
				  }
				  else
				  {
				  	$.fn.raty.start(parseInt(result));
					$.fn.raty.readOnly(true); 
				  }
			      
			   }
			}); 
		}
	});

});

</script>
{% endblock %}

{% block left_content %}
<div id="midLeft">
	
    <div id="app_detail">
    <div class="title"><h2>{{app.name}}</h2></div>
    <div class="pic"><img  src="{{app.image.url_125x125|default:"image/default.jpg"}}" /></div>
    <ul  class="info">
		<li>作者：{{app.auther}}</li>
		<li>作者网站：<a target="_blank" href="{{app.auther_url}}">{{app.auther_url}}</a></li>
		<li>发布时间：{{app.pubdate}}</li>
	   
		<li>标签：{% for tag in tags %}<a href="#">{{tag.name}}</a>{% endfor %}</li>
		<li>评分：<span style="margin-top:10px;" id="star"></span><span<span style="margin-left:20px;">{{score_val}}</span> <span style="margin-left:10px;">共{{stat_count|default:"0"}}人参与评分</span></li>
        </ul>
    <ul class="intro">
        <li><h3>简介：</h3>{{app.summary|linebreaksbr}}</li>
    </ul>
	<ul class="status">
		<li><a href="#">{{app.using}}人在用</a></li>
		<li><a href="#">{{app.want}}人想用</a></li>
		<li><a href="#">{{app.follow}}人关注</a></li>
		<li><a href="#">{{app.rec}}人推荐</a></li>
		<li><a href="#">{{app.like}}人喜欢</a></li>
	</ul>
    <ul class="action">
        <li class="corner"><a href="#">立即下载</a></li>  
		<li class="corner"><a href="#">关注</a></li>
		<li class="corner"><a href="#">想用</a></li>
		<li class="corner"><a href="#">在用</a></li>
		<li class="corner"><a href="/app/comment/add/{{app.id}}">发表评论</a></li>
	</ul>	
	</div>

</div>

<div id="midLeft">
<h3><span class="sLeft">对{{app.name}}的最新评论</span><span class="sRight"></span></h3>	
{% for comment in comments  %}
<div id="comment{{comment.id}}">	
	<div id="app_comment">
		<img alt="{{comment.user.username}}" src="/medias/{{comment.user_image}}" />
		<div class="op_comment">
			{% ifequal request.user.username comment.user.username%}
		    <a href="javascript:void(0);" onclick="delete_comment('{{comment.id}}');"><img src="/medias/images/delete_note.gif"/></a> 
			{% endifequal %}
		</div>
		<div class="comment_text"><a href=" #">{{comment.user.username}}</a>:&nbsp&nbsp;{{comment.content|escape|linebreaksbr}}......</div>
	</div>	
</div>
{% endfor %}
</div >


<div id="midLeft">
	<h3><span class="sLeft">应用图片(共{{app_photo_count}}张)</span><span class="sRight"><a href="/app/photo/add/">添加图片</a></span></h3>
	<ul class="imgPro">
		{% for photo in app_photos %}
		<li><a href="/app/photo/{{photo.id}}" ><img alt="{{photo.name}}" width=140 height=140 src="/medias/{{photo.path}}"/></a></li>
		{% endfor %}		
	</ul>
</div>



{% endblock %}



{% block right_content %}
<div class="hot_tag">
<h3><span class="sLeft">{{app.name}}功能发掘</span><span class="sRight"><a href="/app/feature/add/{{app.id}}/">添加......</a></span></h3>
	<div id="features">
	{% for fea in features %}
    <div>{{fea.content|escape|linebreaksbr}}</div>
	<ul class="action">
		<li><a href="#">{{fea.user.username}}</a></li>
		<li><a href="#">顶({{fea.useful_count}})</a></li>
		<li><a href="#">踩({{fea.useless_count}})</a></li>
	</ul>		
	{% endfor %}
	</div>
</div>

<div class="hot_tag">
<h3><span class="sLeft">{{device.name}}圈子话题</span><span class="sRight"><a href="#">更多......</a></span></h3>
	<div class="tags">
	{% for tag in devtags %}
    <span><a href="/device/tag/{{tag.name}}">{{tag.name}}({{tag.tag_count}})</a></span>
	{% endfor %}
	</div>
</div>
{% endblock %}
